using System;
using System.Collections;
using System.Collections.Generic;
using GameFramework;
using GameFramework.Event;
using GameFramework.Procedure;
using UnityEngine;
using UnityGameFramework.Runtime;
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;

public class Demo4_ProcedureMenu : ProcedureBase
{
    //string str="asd";
    protected override void OnEnter(ProcedureOwner procedureOwner)
    {
        base.OnEnter(procedureOwner);
        //订阅事件的方式:  Event.Subscribe(事件唯一ID, 回调函数)
        GameEntry.Event.Subscribe(OpenUIFormSuccessEventArgs.EventId, OnOpenUIFormSuccess);
        
        //加载UI
        GameEntry.UI.OpenUIForm("Assets/UI/Demo4_UI_Menu" + ".prefab", "DefaultGroup",this);
    }

    private void OnOpenUIFormSuccess(object sender, GameEventArgs e)
    {
        OpenUIFormSuccessEventArgs ne = (OpenUIFormSuccessEventArgs)e;
        //if (ne.UserData.ToString() == this)
        {
            Log.Debug($"<color=yellow>{ne.UserData.ToString()}</color>");
            //return;
        }
        Log.Debug("UI_Menu：恭喜你，成功地召唤了我。");        
    }
}
